home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / CTBUtilities.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  7.4 KB  |  270 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        CTBUtilities.h
  3.  
  4.      Contains:    Communications Toolbox Utilities interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1988-1993, 1995-1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __CTBUTILITIES__
  18. #define __CTBUTILITIES__
  19.  
  20. #ifndef __CONDITIONALMACROS__
  21.     #include <ConditionalMacros.h>
  22. #endif
  23.  
  24. #ifndef __MACTYPES__
  25.     #include <MacTypes.h>
  26. #endif
  27.  
  28. #ifndef __MIXEDMODE__
  29.     #include <MixedMode.h>
  30. #endif
  31.  
  32. #ifndef __DIALOGS__
  33.     #include <Dialogs.h>
  34. #endif
  35.  
  36. #ifndef __APPLETALK__
  37.     #include <AppleTalk.h>
  38. #endif
  39.  
  40.  
  41.  
  42.  
  43. #if PRAGMA_ONCE
  44. #pragma once
  45. #endif
  46.  
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50.  
  51. #if PRAGMA_IMPORT
  52. #pragma import on
  53. #endif
  54.  
  55. #if PRAGMA_STRUCT_ALIGN
  56.     #pragma options align=mac68k
  57. #elif PRAGMA_STRUCT_PACKPUSH
  58.     #pragma pack(push, 2)
  59. #elif PRAGMA_STRUCT_PACK
  60.     #pragma pack(2)
  61. #endif
  62.  
  63. #if CALL_NOT_IN_CARBON
  64. enum {
  65.     curCTBUVersion                = 2                                /* version of Comm Toolbox Utilities*/
  66. };
  67.  
  68. enum {
  69.                                                                 /*    Error codes/types    */
  70.     ctbuGenericError            = -1,
  71.     ctbuNoErr                    = 0
  72. };
  73.  
  74. typedef OSErr                             CTBUErr;
  75. enum {
  76.     chooseDisaster                = -2,
  77.     chooseFailed                = -1,
  78.     chooseAborted                = 0,
  79.     chooseOKMinor                = 1,
  80.     chooseOKMajor                = 2,
  81.     chooseCancel                = 3
  82. };
  83.  
  84. typedef unsigned short                     ChooseReturnCode;
  85. enum {
  86.     nlOk                        = 0,
  87.     nlCancel                    = 1,
  88.     nlEject                        = 2
  89. };
  90.  
  91. typedef unsigned short                     NuLookupReturnCode;
  92. enum {
  93.     nameInclude                    = 1,
  94.     nameDisable                    = 2,
  95.     nameReject                    = 3
  96. };
  97.  
  98. typedef unsigned short                     NameFilterReturnCode;
  99. enum {
  100.     zoneInclude                    = 1,
  101.     zoneDisable                    = 2,
  102.     zoneReject                    = 3
  103. };
  104.  
  105. typedef unsigned short                     ZoneFilterReturnCode;
  106. enum {
  107.                                                                 /*    Values for hookProc items        */
  108.     hookOK                        = 1,
  109.     hookCancel                    = 2,
  110.     hookOutline                    = 3,
  111.     hookTitle                    = 4,
  112.     hookItemList                = 5,
  113.     hookZoneTitle                = 6,
  114.     hookZoneList                = 7,
  115.     hookLine                    = 8,
  116.     hookVersion                    = 9,
  117.     hookReserved1                = 10,
  118.     hookReserved2                = 11,
  119.     hookReserved3                = 12,
  120.     hookReserved4                = 13,                            /*    "virtual" hookProc items    */
  121.     hookNull                    = 100,
  122.     hookItemRefresh                = 101,
  123.     hookZoneRefresh                = 102,
  124.     hookEject                    = 103,
  125.     hookPreflight                = 104,
  126.     hookPostflight                = 105,
  127.     hookKeyBase                    = 1000
  128. };
  129.  
  130.  
  131. /*    NuLookup structures/constants    */
  132.  
  133. struct NLTypeEntry {
  134.     Handle                             hIcon;
  135.     Str32                             typeStr;
  136. };
  137. typedef struct NLTypeEntry                NLTypeEntry;
  138.  
  139. typedef NLTypeEntry                     NLType[4];
  140.  
  141. struct NBPReply {
  142.     EntityName                         theEntity;
  143.     AddrBlock                         theAddr;
  144. };
  145. typedef struct NBPReply                    NBPReply;
  146. typedef CALLBACK_API( short , DialogHookProcPtr )(short item, DialogPtr theDialog);
  147. typedef CALLBACK_API( short , NameFilterProcPtr )(const EntityName *theEntity)/*  (22) added const */;
  148. typedef CALLBACK_API( short , ZoneFilterProcPtr )(ConstStr32Param theZone);
  149. typedef STACK_UPP_TYPE(DialogHookProcPtr)                         DialogHookUPP;
  150. typedef STACK_UPP_TYPE(NameFilterProcPtr)                         NameFilterUPP;
  151. typedef STACK_UPP_TYPE(ZoneFilterProcPtr)                         ZoneFilterUPP;
  152. #if OPAQUE_UPP_TYPES
  153.     EXTERN_API(DialogHookUPP)
  154.     NewDialogHookUPP               (DialogHookProcPtr        userRoutine);
  155.  
  156.     EXTERN_API(NameFilterUPP)
  157.     NewNameFilterUPP               (NameFilterProcPtr        userRoutine);
  158.  
  159.     EXTERN_API(ZoneFilterUPP)
  160.     NewZoneFilterUPP               (ZoneFilterProcPtr        userRoutine);
  161.  
  162.     EXTERN_API(void)
  163.     DisposeDialogHookUPP           (DialogHookUPP            userUPP);
  164.  
  165.     EXTERN_API(void)
  166.     DisposeNameFilterUPP           (NameFilterUPP            userUPP);
  167.  
  168.     EXTERN_API(void)
  169.     DisposeZoneFilterUPP           (ZoneFilterUPP            userUPP);
  170.  
  171.     EXTERN_API(short)
  172.     InvokeDialogHookUPP               (short                    item,
  173.                                     DialogPtr                theDialog,
  174.                                     DialogHookUPP            userUPP);
  175.  
  176.     EXTERN_API(short)
  177.     InvokeNameFilterUPP               (const EntityName *        theEntity,
  178.                                     NameFilterUPP            userUPP);
  179.  
  180.     EXTERN_API(short)
  181.     InvokeZoneFilterUPP               (ConstStr32Param            theZone,
  182.                                     ZoneFilterUPP            userUPP);
  183.  
  184. #else
  185.     enum { uppDialogHookProcInfo = 0x000003A0 };                     /* pascal 2_bytes Func(2_bytes, 4_bytes) */
  186.     enum { uppNameFilterProcInfo = 0x000000E0 };                     /* pascal 2_bytes Func(4_bytes) */
  187.     enum { uppZoneFilterProcInfo = 0x000000E0 };                     /* pascal 2_bytes Func(4_bytes) */
  188.     #define NewDialogHookUPP(userRoutine)                             (DialogHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDialogHookProcInfo, GetCurrentArchitecture())
  189.     #define NewNameFilterUPP(userRoutine)                             (NameFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppNameFilterProcInfo, GetCurrentArchitecture())
  190.     #define NewZoneFilterUPP(userRoutine)                             (ZoneFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppZoneFilterProcInfo, GetCurrentArchitecture())
  191.     #define DisposeDialogHookUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  192.     #define DisposeNameFilterUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  193.     #define DisposeZoneFilterUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  194.     #define InvokeDialogHookUPP(item, theDialog, userUPP)             (short)CALL_TWO_PARAMETER_UPP((userUPP), uppDialogHookProcInfo, (item), (theDialog))
  195.     #define InvokeNameFilterUPP(theEntity, userUPP)                 (short)CALL_ONE_PARAMETER_UPP((userUPP), uppNameFilterProcInfo, (theEntity))
  196.     #define InvokeZoneFilterUPP(theZone, userUPP)                     (short)CALL_ONE_PARAMETER_UPP((userUPP), uppZoneFilterProcInfo, (theZone))
  197. #endif
  198. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  199. #define NewDialogHookProc(userRoutine)                             NewDialogHookUPP(userRoutine)
  200. #define NewNameFilterProc(userRoutine)                             NewNameFilterUPP(userRoutine)
  201. #define NewZoneFilterProc(userRoutine)                             NewZoneFilterUPP(userRoutine)
  202. #define CallDialogHookProc(userRoutine, item, theDialog)        InvokeDialogHookUPP(item, theDialog, userRoutine)
  203. #define CallNameFilterProc(userRoutine, theEntity)                InvokeNameFilterUPP(theEntity, userRoutine)
  204. #define CallZoneFilterProc(userRoutine, theZone)                InvokeZoneFilterUPP(theZone, userRoutine)
  205.  
  206. EXTERN_API( CTBUErr )
  207. InitCTBUtilities                (void);
  208.  
  209. EXTERN_API( short )
  210. CTBGetCTBVersion                (void);
  211.  
  212. EXTERN_API( short )
  213. StandardNBP                        (Point                     where,
  214.                                  ConstStr255Param         prompt,
  215.                                  short                     numTypes,
  216.                                  NLType                 typeList,
  217.                                  NameFilterUPP             nameFilter,
  218.                                  ZoneFilterUPP             zoneFilter,
  219.                                  DialogHookUPP             hook,
  220.                                  NBPReply *                theReply);
  221.  
  222. EXTERN_API( short )
  223. CustomNBP                        (Point                     where,
  224.                                  ConstStr255Param         prompt,
  225.                                  short                     numTypes,
  226.                                  NLType                 typeList,
  227.                                  NameFilterUPP             nameFilter,
  228.                                  ZoneFilterUPP             zoneFilter,
  229.                                  DialogHookUPP             hook,
  230.                                  long                     userData,
  231.                                  short                     dialogID,
  232.                                  ModalFilterUPP         filter,
  233.                                  NBPReply *                theReply);
  234.  
  235. #if OLDROUTINENAMES
  236. #define NuLookup(where, prompt, numTypes, typeList, nameFilter, zoneFilter,    \
  237. hook, theReply)                                                                \
  238. StandardNBP(where, prompt, numTypes, typeList, nameFilter, zoneFilter,         \
  239. hook, theReply)
  240. #define NuPLookup(where, prompt, numTypes, typeList, nameFilter,                 \
  241. zoneFilter, hook, userData, dialogID, filter, theReply)                        \
  242. CustomNBP(where, prompt, numTypes, typeList, nameFilter,                         \
  243. zoneFilter, hook, userData, dialogID, filter, theReply)
  244. #endif  /* OLDROUTINENAMES */
  245.  
  246. #endif  /* CALL_NOT_IN_CARBON */
  247.  
  248.  
  249.  
  250. #if PRAGMA_STRUCT_ALIGN
  251.     #pragma options align=reset
  252. #elif PRAGMA_STRUCT_PACKPUSH
  253.     #pragma pack(pop)
  254. #elif PRAGMA_STRUCT_PACK
  255.     #pragma pack()
  256. #endif
  257.  
  258. #ifdef PRAGMA_IMPORT_OFF
  259. #pragma import off
  260. #elif PRAGMA_IMPORT
  261. #pragma import reset
  262. #endif
  263.  
  264. #ifdef __cplusplus
  265. }
  266. #endif
  267.  
  268. #endif /* __CTBUTILITIES__ */
  269.  
  270.